import type { UploadRawFile, ElTree, FormInstance, FormRules, ElAutocomplete, ElTable,ElCol, UploadUserFile, UploadInstance, UploadProps, ElInput, ElDialog, ElDropdown, ElSelectV2, ElSelect } from 'element-plus'
import type Node from 'element-plus/es/components/tree/src/model/node'
import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'

type tableOrder = 'descending' | 'ascending'

// 表格统计
interface SummaryMethodProps<T = any> {
  columns: TableColumnCtx<T>[]
  data: T[]
}

export interface ELComponentInstance<T = any> {
  formRules: FormRules
  formRef: FormInstance
  treeNode: Node
  treeRef: InstanceType<typeof ElTree>
  tableColumn: TableColumnCtx<T>
  // sort-change回调的形参
  tableSort: {
    prop: string
    column: TableColumnCtx<T>
    order: tableOrder
  },
  autoCompleteRef: InstanceType<typeof ElAutocomplete>
  tableRef: InstanceType<typeof ElTable>
  // up-load组件默认上传文件时的文件类型
  userFile: UploadUserFile
  uploadRef: UploadInstance
  // up-load组件文件上传时触发的所有事件对应的的属性
  uploadProps: UploadProps
  uploadRawFile: UploadRawFile
  inputRef: InstanceType<typeof ElInput>
  summaryProps: SummaryMethodProps<T>
  dialogRef: InstanceType<typeof ElDialog>
  dropDownRef: InstanceType<typeof ElDropdown>
  selectV2Ref: InstanceType<typeof ElSelectV2>
  selectRef:InstanceType<typeof ElSelect>
  colRef:InstanceType<typeof ElCol>
}